/**
 * 前期开发，没有thunk，hook，widget
 */
function isVNode(x) {
    return x && x.type === "VirtualNode" 
}
export class VNode{
    type:string="VirtualNode";
    tagName:string;
    properties:any;
    children:any[];
    namespace:string;
    count:number;
    constructor(tagName:string,properties?:any,children?:any[],public key?:string,namespace?:string){
        this.tagName=tagName;
        this.properties=properties||{};
        this.children=children||[];
        this.namespace=namespace||"";
        this.count = (children && children.length) || 0;
        var descendants = 0;
        for (var i = 0; i <  this.count; i++) {
            var child = children[i]
            if (isVNode(child)) {
                descendants += child.count || 0
            } 
        }
    }
}